﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_ManufactureList.cshtml";
}
<script type="text/javascript">
    var FSign = '';
    $(function () {
        initControl();
        gridList();
        getTopContent();
    });
    function initControl() {
        //$('select').bindSelect();
    }
    function getTopContent() {
        emptyDataById("#topContent");
        $.getJSON("/BOM/Product/GetMultiQueryTopJson?seed" + new Date().getTime(), function (data) {
            if (data.length > 0) {
                setDataByJson("#topContent", data[0]);
                //alert(data[0].FSign);
                FSign = data[0].FSign;
                if (data[0].FSign == "H") {
                    $('#topContentNum').text("零件编号");
                    $('#topContentName').text("零件名称");
                    $('#topContentDate').text("回归日期");
                    $('#topContentTime').text("回归时间");
                    $("#gridList").jqGrid('setGridParam', {
                        url: "/BOM/Product/GetMultiQueryDetailJson",
                        postData: { keyword: $("#txt_keyword").val() },
                    }).showCol("PFDH").trigger('reloadGrid');
                } else {
                    $('#topContentNum').text("总成系统");
                    $('#topContentName').text("总成名称");
                    $('#topContentDate').text("展开日期");
                    $('#topContentTime').text("展开时间");
                    $("#gridList").jqGrid('setGridParam', {
                        url: "/BOM/Product/GetMultiQueryDetailJson",
                        postData: { keyword: $("#txt_keyword").val() },
                    }).hideCol("PFDH").trigger('reloadGrid');
                }
            }
        });
    }
    function gridList() {
        var $gridList = $("#gridList");
        $gridList.dataGrid({
            height: $(window).height() - 180,
            colModel: [
                { label: '总成编号', name: 'PFDH', width: 140, align: 'left', sortable: false},
                { label: '版本', name: 'BB', width: 40, align: 'center', sortable: false },
                { label: '版次', name: 'BC', width: 40, align: 'center', sortable: false },
                { label: '层次', name: 'CCBZ', width: 40, align: 'center', sortable: false },
                { label: '位置号', name: 'WZH', width: 80, align: 'center', sortable: false },
                { label: '零件编号', name: 'TH', width: 140, align: 'left', sortable: false },
                { label: '零件名称', name: 'MC', width: 220, align: 'left', sortable: false },
                { label: '数量', name: 'SL', width: 40, align: 'right', sortable: false },
                { label: '类', name: 'LEI', width: 60, align: 'left', sortable: false },
                { label: '特征', name: 'TX', width: 40, align: 'center', sortable: false },
                { label: '状态', name: 'ZT', width: 40, align: 'center', sortable: false },
                { label: '类别', name: 'LB', width: 40, align: 'center', sortable: false },
                { label: '装配', name: '', width: 40, align: 'left', sortable: false },
                { label: '制造路线', name: '', width: 160, align: 'left', sortable: false },
                { label: '生效日期', name: 'StartDate', width: 120, align: 'center', sortable: false },
                { label: '失效日期', name: 'StopDdate', width: 120, align: 'center', sortable: false },
                { label: '技术更改单编号', name: 'LXD', width: 120, align: 'center', sortable: false },
                { label: '技术更改单日期', name: 'LXDRQ', width: 120, align: 'center', sortable: false },
                { label: '参考图号', name: 'CTH', width: 120, align: 'left', sortable: false },
                { label: '图幅', name: 'TF', width: 60, align: 'center', sortable: false },
                { label: '重量', name: 'ZL', width: 60, align: 'right', sortable: false },
                { label: '材料', name: 'CL', width: 80, align: 'left', sortable: false },
                { label: '分级', name: 'JF', width: 80, align: 'center', sortable: false },
                { label: '备注', name: 'BZ', width: 240, align: 'left', sortable: false }
            ],
            pager: "#gridPager",
            sortname: 'ZDH01 asc,ZDH02 asc,ZDH03 asc,ZDH04 asc,ZDH05 asc,ZDH06 asc,ZDH07 asc,ZDH08 asc,ZDH09 asc,ZDH10 asc,ZDH11 asc,ZDH12 asc,ZDH13 asc,ZDH14 asc',
            viewrecords: true,
            rownumWidth: 40
        });
        $gridList.jqGrid('setLabel', 0, '序号', 'rowNumberHeaderStyle');
        $gridList.jqGrid('setFrozenColumns');
        $("#btn_search").click(function () {
            $gridList.jqGrid('setGridParam', {
                url: "/BOM/Product/GetMultiQueryDetailJson",
                postData: { number: $("#txt_keyword").val() },
            }).trigger('reloadGrid');
        });
    }
    function btn_calculate() {
        $.detailOpen({
            id: "Detail",
            title: "",
            url: "/BOM/Product/MultiQueryCalculate"
        });
    }
    function resetPage() {
        $.detailClose();
        initControl();
        gridList();
        getTopContent();
    }
</script>
<div id="layout" style="height: 100%; width: 100%;">
    <form id="form1">
        <div style="padding: 12px 0 5px 0; padding-left: 15px; border-bottom: 1px solid #ccc; " class="line-table input-width-185">
            <div class="btn-group" style="margin-top:-9px;">
                零部件号<br /><input id="txt_keyword" name="txt_keyword"  type="text" class="form-control" /> &nbsp;
            </div>
            <div class="btn-group" style="">
                <a id="btn_search" class="btn btn-primary center-block" onclick=""><span class="glyphicon glyphicon-search"></span> 查询</a>
            </div>
            <div class="btn-group" style="float:right;">
                <a id="" class="btn btn-primary center-block" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span> 刷新</a>
                <a id="" class="btn btn-primary center-block disabled" onclick="" href="/BOM/Product/MultiQuery"><span class="glyphicon glyphicon-th-list"></span> 明细</a>
                <a id="" class="btn btn-primary center-block" onclick="" href="/BOM/Product/MultiQueryStructure"><span class="glyphicon glyphicon-list-alt"></span> 结构</a>
                <a id="" class="btn btn-primary center-block" onclick="btn_calculate()" ><span class="glyphicon glyphicon-edit"></span> 计算</a>
                <a id="" class="btn btn-primary center-block disabled" onclick=""><span class="glyphicon glyphicon-download"></span> 导出</a>
            </div>
        </div>
        <table id="topContent" class="form" style="margin:5px 0 5px 15px;width:1060px">
            <tr>
                <th id="topContentNum" class="formTitle" style="width:60px;">
                    总成系统
                </th>
                <td class="formValue" style="width:220px;">
                    <input id="TH" name="TH" type="text" class="form-control" readonly="readonly" />
                </td>
                <th class="formTitle" style="width:40px;">
                    类
                </th>
                <td class="formValue" style="width:80px;">
                    <input id="LEI" name="LEI" type="text" class="form-control" readonly="readonly" />
                </td>
                <th class="formTitle" style="width:40px;">
                    装配
                </th>
                <td class="formValue" style="width:200px;">
                    <input id="" name="" type="text" style="width:60px;" class="form-control" readonly="readonly" />
                </td>
                <th class="formTitle" style="width:40px;">
                    版本
                </th>
                <td class="formValue" style="width:60px;">
                    <input id="BB" name="BB" type="text" class="form-control" readonly="readonly" />
                </td>
                <th class="formTitle" style="width:60px;">
                    更改单号
                </th>
                <td class="formValue" style="width:120px;">
                    <input id="LXD" name="LXD" type="text" class="form-control" readonly="readonly" />
                </td>
                <th id="topContentDate" class="formTitle" style="width:60px;">
                    展开日期
                </th>
                <td class="formValue" style="width:80px;">
                    <input id="FCreateDate" name="FCreateDate" type="text" class="form-control" readonly="readonly" />
                </td>
            </tr>
            <tr>
                <th id="topContentName" class="formTitle">
                    总成名称
                </th>
                <td class="formValue">
                    <input id="MC" name="MC" type="text" class="form-control" readonly="readonly" />
                </td>
                <th class="formTitle">
                    特征
                </th>
                <td class="formValue">
                    <input id="TX" name="TX" type="text" class="form-control" readonly="readonly" />
                </td>
                <th class="formTitle">
                    制造
                </th>
                <td class="formValue">
                    <input id="" name="" type="text" class="form-control" readonly="readonly" />
                </td>
                <th class="formTitle">
                    版次
                </th>
                <td class="formValue">
                    <input id="BC" name="BC" type="text" class="form-control" readonly="readonly" />
                </td>
                <th class="formTitle">
                    参考图号
                </th>
                <td class="formValue">
                    <input id="CTH" name="CTH" type="text" class="form-control" readonly="readonly" />
                </td>
                <th id="topContentTime" class="formTitle">
                    展开时间
                </th>
                <td class="formValue">
                    <input id="FCreateTime" name="FCreateTime" type="text" class="form-control" readonly="readonly" />
                </td>
            </tr>
        </table>
    </form>
    <div style="">
        <table id="gridList"></table>
        <div id="gridPager"></div>
    </div>
</div>

